var t = getApp();

Page({
    data: {
        active: 0,
        page: 1,
        info: "",
        ind: null
    },
    onLoad: function(t) {
        this.getdata();
    },
    shows: function(t) {
        console.log(t);
        var a = t.currentTarget.dataset.ind;
        null == this.data.ind || this.data.ind != a ? this.setData({
            ind: a
        }) : this.setData({
            ind: null
        });
    },
    swichTabTItem: function(t) {
        this.setData({
            active: t.detail.index,
            page: 1,
            ind: null,
            list: []
        }), this.getdata();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if (!(this.data.current_page >= this.data.last_page)) {
            var t = this.data.page + 1;
            this.setData({
                page: t
            }), this.getMore();
        }
    },
    onShareAppMessage: function() {},
    getdata: function() {
        wx.showLoading({
            title: "加载中"
        });
        var a = this, e = t.getNetAddresss("plugin.sell-award.frontend.home.index");
        t._postNetWork({
            url: e,
            data: {
                state: this.data.active,
                page: this.data.page
            },
            success: function(t) {
                var e = t.data;
                wx.hideLoading({
                    success: function(t) {}
                }), 1 == e.result ? (console.log(e.data), a.setData({
                    award_total: e.data.award_total,
                    info: e.data.member,
                    list: e.data.list.data,
                    current_page: e.data.list.current_page,
                    last_page: e.data.list.last_page
                })) : wx.showToast({
                    title: e.msg,
                    duration: 1e3,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    getMore: function() {
        wx.showLoading({
            title: "加载中"
        });
        var a = this, e = t.getNetAddresss("plugin.sell-award.frontend.home.index");
        t._postNetWork({
            url: e,
            data: {
                state: this.data.active,
                page: this.data.page
            },
            success: function(t) {
                var e = t.data;
                wx.hideLoading({
                    success: function(t) {}
                }), 1 == e.result ? a.setData({
                    info: e.data,
                    list: a.data.list.concat(e.data.list.data),
                    current_page: e.data.list.current_page,
                    last_page: e.data.list.last_page
                }) : wx.showToast({
                    title: e.msg,
                    duration: 1e3,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    }
});